//
//  WDCancelWorkOrderViewModel.m
//  wd-serviceapp
//
//  Created by Bin Tang on 2024/8/6.
//

#import "WDCancelWorkOrderViewModel.h"

@implementation WDCancelWorkOrderViewModel

- (void)initialize {
    [super initialize];
    self.title = @"取消工单";
    
    _reqModel = [WDCancelTaskApplyReqModel new];
    _reqModel.engineerId = @([EDSAppDelegateTool sharedInstance].userInfoModel.id);
    _reqModel.stationId = @([EDSAppDelegateTool sharedInstance].userInfoModel.stationId);
}

- (void)setupData {
    _reqModel.taskId = @(self.serviceModel.id);
}

/// 取消申请
/// - Parameter completion: completion description
- (void)requestWithCancelApply:(RequestCompletionBlock)completion {
    @weakify(self);
    WDCancelTaskApplyRequest *request = [[WDCancelTaskApplyRequest alloc] initWithModel:self.reqModel];
    [request startWithCompletionBlockWithSuccess:^(__kindof TYZBaseRequest * _Nonnull request) {
        @strongify(self);
        [self sendResponseObject:request.responseModelObject completion:completion];
    } failure:^(__kindof TYZBaseRequest * _Nonnull request) {
        @strongify(self);
        [self sendResponseObject:request.responseModelObject completion:completion];
    }];
}

@end
